package com.example.feignclients;

import com.example.entity.Comment;
import com.example.entity.Favorite;
import com.example.entity.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/*
 * @Author: hx
 * @CreateTime: 2022/3/7 17:00
 * @Description:
 * */
@FeignClient("API-USERS")
public interface UserClients {
    @GetMapping("/userInfo/{id}")
    User user(@PathVariable("id")Integer id);

    /**
     * 判断该用户是否收藏该视频
     * @param videoId
     * @param userId
     * @return
     */
    @GetMapping("/userInfo/favorite")
    Favorite favorite(String videoId, String userId);

    /**
     * 视频评论
     * @param videoId
     * @param page
     * @param rows
     * @return
     */
    @GetMapping("/user/comments")
    Map<String, Object> comments(@RequestParam("videoId") String videoId,
                                 @RequestParam("page") Integer page,
                                 @RequestParam("per_page") Integer rows);

    //用户评论
    @PostMapping("/user/comment/{userId}/{videoId}")
    void comments(@PathVariable("userId") Integer userId,@PathVariable("videoId") Integer videoId, @RequestBody Comment comment);
}
